package com.example.model;

import java.util.Date;

/**
 * 博客实体类
 */
public class Blog {
    private int id;
    private String title; // 博客标题
    private String content; // 博客内容
    private String category; // 博客类别
    private Date createTime; // 发布时间
    private Date updateTime; // 更新时间
    private int userId; // 作者ID
    private String authorName; // 作者名称（冗余字段便于查询）
    private int viewCount; // 阅读量
    
    // 无参构造函数
    public Blog() {
    }
    
    // 带参构造函数
    public Blog(int id, String title, String content, String category, Date createTime, 
                Date updateTime, int userId, String authorName, int viewCount) {
        this.id = id;
        this.title = title;
        this.content = content;
        this.category = category;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.userId = userId;
        this.authorName = authorName;
        this.viewCount = viewCount;
    }
    
    // Getter和Setter方法
    public int getId() {
        return id;
    }
    
    public void setId(int id) {
        this.id = id;
    }
    
    public String getTitle() {
        return title;
    }
    
    public void setTitle(String title) {
        this.title = title;
    }
    
    public String getContent() {
        return content;
    }
    
    public void setContent(String content) {
        this.content = content;
    }
    
    public String getCategory() {
        return category;
    }
    
    public void setCategory(String category) {
        this.category = category;
    }
    
    public Date getCreateTime() {
        return createTime;
    }
    
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    
    public Date getUpdateTime() {
        return updateTime;
    }
    
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    
    public int getUserId() {
        return userId;
    }
    
    public void setUserId(int userId) {
        this.userId = userId;
    }
    
    public String getAuthorName() {
        return authorName;
    }
    
    public void setAuthorName(String authorName) {
        this.authorName = authorName;
    }
    
    public int getViewCount() {
        return viewCount;
    }
    
    public void setViewCount(int viewCount) {
        this.viewCount = viewCount;
    }
    
    @Override
    public String toString() {
        return "Blog{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", category='" + category + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", userId=" + userId +
                ", authorName='" + authorName + '\'' +
                ", viewCount=" + viewCount +
                '}';
    }
} 